<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="Stylesheet" href="{TPL}css/NewTopFoot.css" />
<link href="{TPL}css/AddItemPanel.css" rel="stylesheet" type="text/css" />
<script src="{TPL}js/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="{TPL}js/jQuery.Extend.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/jQuery.Drag.min.js"></script>
<script src="{TPL}js/jquery.cookies.2.1.0.min.js" type="text/javascript"></script>
<script type="text/javascript" src="{TPL}js/Gobal.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{lang heart_demand_peace}--{$cfg_site_name}_{lang buy_all_over_China}-{$cfg_site_name}{lang Purchasing_Chinese_goods}</title>
<meta name="keywords" content="代购，海外华人，留学生" />
<meta name="description" content="{$cfg_site_name}－{lang Shopping_world_largest_network_purchasing" />
<style type="text/css">

        .main_other
        {
            width: 950px;
			overflow:hidden;
            height: auto;
            margin: auto;
			border: 1px #f45s12;
            text-align: center;
            background: #ff0;
        }
        .p_sale1
        {
            width: 950px;
            height: 30px;
            float: left;
			margin:0 auto;
        }
        .p_sale2
        {
            width: 500px;
            height: 100px;
            float: left;
			overflow:hidden;
        }
        .p_sale3
        {
            width: 450px;
            height: 100px;
            float: left;
			overflow:hidden;
        }
        .p_sdh
        {
            width: 950px;
            height: 35px;
			margin-left:150px;
            background: #fff2d0;
            border-top: 2px solid #ff9b00;
            display: inline;
            font-size: 14px;
            text-align: center;
        }
        .p_sdh a:link, .p_sdh a:visited
        {
            color: #0764B5;
            text-decoration: none;
        }
        .p_sdh a:hover
        {
            color: #FF4200;
            text-decoration: underline;
        }
        .p_sdh a:active
        {
            color: #0764B5;
            text-decoration: none;
        }
        .p_sdh ul
        {
            width: 950px;
            height: 30px;
        }
        .p_sdh ul li
        {
            display: inline;
            text-indent: 10px;
            float: left;
        }
        .p_left
        {
            height: 30px;
            line-height: 30px;
            vertical-align: middle;
            width: 500px;
            text-align: left;
        }
        .p_right
        {
            height: 30px;
            line-height: 30px;
            vertical-align: middle;
            width: 430px;
            text-align: right;
        }
        .clear
        {
            clear: both;
        }
        .p_main
        {
            width: 950px;
            height: auto;
            margin-top: 10px;
            margin-bottom: 20px;
            background: #fff;
        }
        .p_s5
        {
            width: 200px;
            height: 220px;
            margin: 10px 8px 10px 22px;
            float: left;
            background: url({TPL}images/preference_5y.jpg) no-repeat;
        }
        .p_s10
        {
            width: 200px;
            height: 220px;
            margin: 10px 8px 10px 22px;
            float: left;
            background: url({TPL}images/preference_10y.jpg) no-repeat;
        }
        .p_s20
        {
            width: 200px;
            height: 220px;
            margin: 10px 8px 10px 22px;
            float: left;
            background: url({TPL}images/preference_20y.jpg) no-repeat;
        }
        .p_s50
        {
            width: 200px;
            height: 220px;
            margin: 10px 8px 10px 22px;
            float: left;
            background: url({TPL}images/preference_50y.jpg) no-repeat;
        }
        .p_content
        {
            width: 180px;
            height: 120px;
            margin: 60px 0 auto;
            font-size: 13px;
            font-weight: bold;
        }
        .p_content li
        {
            text-align: left;
            width: 180px;
            height: 30px;
            line-height: 30px;
            vertical-align: middle;
            text-indent: 10px;
        }
        #p_button
        {
            text-align: center;
        }
        .f2
        {
            color: #ff4200;
            font-size: 12px;
            font-weight: normal;
        }
        .f3
        {
            color: #FF4200;
            display: inline;
            font-size: 13px;
        }

.pages {float:right;height:25px;margin:15px 0 0 0;display:inline;}
.pages li{list-style-type: none;}
.pages  a{text-decoration:none;}
.pages li{border:1px solid #AAAAAA;color:#666666;display:inline;float:left;height:20px;line-height:20px;margin-left:2px;padding:0 5px;text-decoration:none;}
.pages li {border:1px solid #DDDDDD;color:#CCC;font-family:"simsun";}
.pages li:hover {background:#FFEDE1;border:1px solid #FF9900;}
.pages .current {background:#FFEDE1;border:1px solid #FF6600;color:#FF0000;}
.pages em {color:#999999;display:inline;float:left;height:22px;line-height:22px;margin-left:5px;}

</style>
<script type="text/javascript">
        $(function() {
            $("#selCouponType").val('0');
            $("#selSortType").val('0');
            $("#selCouponType").change(function() { window.location = '/coupon.php?money=' + $(this).val() + '&shortType=' + $('#selSortType').val(); });
            $("#selSortType").change(function() { window.location = '/coupon.php?money=' + $('#selCouponType').val() + '&shortType=' + $(this).val(); });
        });
		
var flag = false;
var uname='{$_USERS['uname']}';
var money='{$_USERS['money']}';
function buyCoupon(code,price) {
    if (flag) return false;
	if (!uname) { alert("请登录后操作"); return false; }
    if (money < price) { alert("您的账户余额不足，无法兑换优惠券"); return false; }
    if (!confirm("优惠券只能用于抵扣服务费，如果优惠券面额超过服务费将无法退回差值。您是否确认购买？")) return false;
    flag = true;

    $.ajax({
        type: "POST",
        url: "/ajax/coupon_ajax.php?action=buycoupon",
        dataType: "json",
        contentType: "application/json;utf-8",
        data: "{'code':'" + code + "'}",
        timeout: 8000,
        error: function() { alert("购买失败，请稍后再试"); flag = false; return false;},
        success: function(res) {
            flag = false;
            var s = res;
            switch (s) {
                case "OK": alert("购买成功!"); return false;break;
                default: alert(s);return false;break;
            }
        }
    });
}		
		
		
</script>
</head>
<body>
{template 'header'}
<div class="clear"></div>

     <div class="main w960">
    
    <div class="main_other w960">
	
        <div class="p_sale1">
            <a name="top">
                <img src="{TPL}images/youhuiqu.jpg" />
			</a>
		</div>
		
  
        <div class="p_sdh w960">

            <ul>
                <li>{lang Select_Coupon}：
                    <select id="selCouponType">
                        <option value="0">{lang Any_amount}</option>
                        <option value="5">{lang 5_coupons}</option>
                        <option value="10">{lang 10_coupons}</option>
                        <option value="20">{lang 20_coupons}</option>
                        <option value="50">{lang 50_coupons}</option>
                    </select>
                    &nbsp;&nbsp; &nbsp;&nbsp; {lang Sort_by}：
                    <select id="selSortType">
                        <option value="0">{lang Default_Sort}</option>
                        <option value="1">{lang Price_Ascending}</option>
                        <option value="2">{lang Price_Descending}</option>
                        <option value="3">{lang Ascending_maturity}</option>
                        <option value="4">{lang Maturity_descending}</option>
                    </select>
					&nbsp;&nbsp;&nbsp;&nbsp;<a href="{url_coupon.php}" id="ctl00_ctl00_NewContentPlaceHolder_ContentPlaceHolder1_next">{lang See_all}</a>
                </li>

            </ul>
        </div>

        <div class="p_main">
            
			{loop $dataarray $r}
			
                    <div class="p_s{$r['money']}">
                        <ul class="p_content">
                            <li>{lang seller}：<span class="f3">{$r['uname']}</span></li>
                            <li>{lang Price}：<span class="f3">{$r['sellmoney']}{lang Element}</span></li>
                            <li style="text-decoration: none; font-weight: normal; font-size: 12px;">{lang Period}：<span
                                class="f2">{date('Y-m-d',$r['endtime'])}</span></li>

                            <li>&nbsp;</li>
                            <li id="p_button">
                                <input type="image" src="{TPL}images/preference_an.jpg"  onclick="buyCoupon('{$r['sn']}',{$r['sellmoney']})" style="border-width:0px;" /></li>
                        </ul>
                    </div>
            {/loop}    
				
				
              
                
        </div>
		 {echo pagelist($total,$pagesize,$page,"");}
        <div class="p_sdh">
            <ul>
                <li class="p_left">

 
					
                </li>
                <li class="p_right"><a href="#top">{lang Back_top}</a></li></ul>

        </div>
    </div>
</div>

    
{template 'footer'}


</body>
</html>
